<!--
 * @Author: 周艳凯 484894717@qq.com
 * @Date: 2025-03-26 13:48:15
 * @LastEditors: 周艳凯 484894717@qq.com
 * @LastEditTime: 2025-04-12 19:12:53
 * @FilePath: \BusStopBoard.Webd:\360MoveData\Users\75041\Desktop\uniapp框架\my-project\src\pages\index\tnoticBar.vue
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
-->
<template>
    <view class="carousel" v-if="datas.length > 0">
        <TNoticeBar :lists="datas" backColor="#000" color="red" intval_1="1000"></TNoticeBar>
        <!-- <NoticeBar :lists="datas"></NoticeBar> -->
        <!-- <yxpcroll :text="datas" fontSize="28" duration="4000" delay="500" txtPadding="100"></yxpcroll>
        <u-notice-bar  icon="" text="挖矿打卡时间可达世界等级阿萨达久啊手机打" bgColor="#000" fontSize="28" color="red"  speed="160"></u-notice-bar> -->
    </view>
</template>

<script>
import TNoticeBar from '@/uni_modules/wormjan-swiper/components/wormjan-swiper/wormjan-swiper.vue'
import NoticeBar from './NoticeBar/index.vue'
export default {
    components: {
        TNoticeBar,
        // NoticeBar
        // yxpcroll
    },
    data() {
        return {
            datas: []
        }
    },
    computed: {
        textData() {
            return this.$store.getters.gettextArray;
        },
        PushText() {
            return this.$store.getters.getPushText;
        }
    },
    watch: {
        PushText: {
            deep: true,
            handler() {
                this.init()
            }
        },
        textData: {
            deep: true,
            handler() {
                this.init()
            }
        }
    },
    mounted() {
        this.init()
    },
    methods: {
        init() {
            this.datas = []
            const data = this.textData;
            const arrs = this.PushText
                .map((item, i) => item ?? data?.[i]?.name)
                .filter(item => item != null)
                .map((item, index) => ({ id: index, title: item }));


            // let result = '';
            // for (let i = 0; i < arrs.length; i++) {
            //     result += arrs[i].title           // 添加当前诗句
            //     if (i < arrs.length - 1) {   // 非最后一个元素时补空格
            //         result += ' ';
            //     }
            // }

            // const lida = [
            //     '寒雨连江夜入吴寒雨连江夜入吴寒雨连江夜入吴寒雨连江夜入吴寒雨连江夜入吴寒雨连江夜入吴',
			// 	'平明送客楚山孤',
			// 	'洛阳亲友如相问',
			// 	'一片冰心在玉壶'
            // ]


            // const sada = lida.map((item,index)=>{
            //     return {
            //         id:index,
            //         title:item
            //     }
            // })

            // console.log(sada,'我参数2');

            this.datas = arrs

            // const data = this.textData.promotionSlogan
            // const baowen = []
            // for (let i = 0; i < this.PushText.length; i++) {
            //     if (i < this.PushText.length) { // 确保不会超出 PushText 的范围
            //         if (this.PushText[i] != null) {
            //             baowen.push(this.PushText[i])
            //         } else {
            //             baowen.push(data[i])
            //         }
            //     }
            // }
            // const aiia = baowen.filter(item => {
            //     return item != null
            // })
            // const xinarr = aiia.map((item, index) => {
            //     return {
            //         id: index,
            //         title: item
            //     }
            // })
            // this.datas = xinarr
        },
    }
}
</script>

<style lang="scss" scoped>
.carousel {
    width: 100%;
    height: 54rpx;
    // margin-bottom: 10rpx;
    background: #000;
    display: flex;
    // justify-content: center;
    align-items: center;
}
</style>